package com.zzvcom.webapp.action.example;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Controller;

import com.googlecode.jsonplugin.annotations.SMDMethod;
import com.opensymphony.xwork2.ActionSupport;
import com.zzvcom.persist.model.user.User;
import com.zzvcom.service.UserManager;
import com.zzvcom.template.ResultPage;
@Controller    @Scope("prototype")        //声明此类为控制层的类,且为prototype模式调用
public class JsonUserAction extends ActionSupport
{
    
    /**
     * 
     */
    private static final long serialVersionUID = 199090909L;

    private UserManager userManager;
    
    private List<User> users;
    
    private ResultPage resultPage;
    
    private User user;
    
    public String execute()
    {
        return "index";
    }
    
    public String testJson() throws Exception
    {        
        return "rs";
    }
    
    @SMDMethod
    public List smd(String username)
    {
        return userManager.queryByHQL("from User where username=?", username);
    }

    public UserManager getUserManager()
    {
        return userManager;
    }

    @Autowired
    public void setUserManager(UserManager userManager)
    {
        this.userManager = userManager;
    }

    public List<User> getUsers()
    {
        return users;
    }

    public void setUsers(List<User> users)
    {
        this.users = users;
    }

    public ResultPage getResultPage()
    {
        return resultPage;
    }

    public void setResultPage(ResultPage resultPage)
    {
        this.resultPage = resultPage;
    }

    public User getUser()
    {
        return user;
    }

    public void setUser(User user)
    {
        this.user = user;
    }   
    
    
    
}
